#/*Copyright 2020-2021 T-Head Semiconductor Co., Ltd.
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
#Unless required by applicable law or agreed to in writing, software
#distributed under the License is distributed on an "AS IS" BASIS,
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#See the License for the specific language governing permissions and
#limitations under the License.
#*/
#*/
#*/
CPU_ARCH_FLAG_0 := e906f
CPU_ARCH_FLAG_1 := nodsp
CASE_LIST := \
    debug_2wire_jtag \
    ISA_RV32F \
    dhry \
    memset \
    debug \
    memcp \
	ISA_RV32IMAC \
    csr_rw_extend \
	coremark \
	hello_world \
	basicmath \
	bitcount \
    qsort \
	stringsearch \
	dijkstra \
	crc \
	crc32 \
	ctl \
	compress \
	fir \
	insertsort \
	nettle_des \
	nettle_md5 \
	rijndael \
	cover \
	ctl_stack \
	ctl_vector \
	duff \
	jfdctint \
	lcdnum \
	sglib_dllist \
	sglib_listinsertsort \
	sglib_hashtable \
	sglib_rbtree \
	sha \
	trio_sscanf \
	qurt \



	


debug_2wire_jtag_build:
	@cp ./tests/cases/debug_2wire_jtag/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=debug_2wire_jtag FILE=E906_DEBUG_PATTERN >& debug_2wire_jtag_build.case.log 


ISA_RV32F_build:
	@cp ./tests/cases/ISA/RV32F/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=ISA_RV32F FILE=E906_RV32F_INSTRUCTIONS >& ISA_RV32F_build.case.log 


dhry_build:
	@cp ./tests/cases/dhry/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=dhry FILE=dhry_1_main >& dhry_build.case.log 


memset_build:
	@cp ./tests/cases/memset/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=memset FILE=mem_set_main >& memset_build.case.log 


debug_build:
	@cp ./tests/cases/debug/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=debug FILE=E906_DEBUG_PATTERN >& debug_build.case.log 


memcp_build:
	@cp ./tests/cases/memcp/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=memcp FILE=mem_copy_main >& memcp_build.case.log 




ISA_RV32IMAC_build:
	@cp ./tests/cases/ISA/RV32IMAC/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=ISA_RV32IMAC FILE=E906_RV32IMAC_INSTRUCTIONS >& ISA_RV32IMAC_build.case.log 



csr_rw_extend_build:
	@cp ./tests/cases/csr/csr_rw_extend/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=csr_rw_extend FILE=E906_EXTEND_CSR_RW >& csr_rw_extend_build.case.log 


coremark_build:
	@cp ./tests/cases/coremark/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=coremark FILE=core_main >& coremark_build.case.log 


hello_world_build:
	@cp ./tests/cases/hello_world/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=hello_world FILE=hello_world_main >& hello_world_build.case.log 


basicmath_build:
	@cp ./tests/cases/basicmath/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=basicmath FILE=basicmath_main >& basicmath_build.case.log 

bitcount_build:
	@cp ./tests/cases/bitcount/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=bitcount FILE=bitcount_main >& bitcount_build.case.log 
qsort_build:
	@cp ./tests/cases/qsort/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=qsort FILE=qsort_main >& qsort_build.case.log 

stringsearch_build:
	@cp ./tests/cases/stringsearch/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=stringsearch FILE=stringsearch_main >& stringsearch_build.case.log 

dijkstra_build:
	@cp ./tests/cases/dijkstra/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=dijkstra FILE=dijkstra_main >& dijkstra_build.case.log 

crc_build:
	@cp ./tests/cases/crc/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=crc FILE=crc_main >& crc_build.case.log 

crc32_build:
	@cp ./tests/cases/crc32/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=crc32 FILE=crc_main >& crc32_build.case.log 



rijndael_build:
	@cp ./tests/cases/rijndael/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=rijndael FILE=rijndael_main >& rijndael_build.case.log 


ctl_build:
	@cp ./tests/cases/ctl/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=ctl FILE=ctl_main >& ctl_build.case.log 

compress_build:
	@cp ./tests/cases/compress/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=compress FILE=compress_main >& compress_build.case.log 

fir_build:
	@cp ./tests/cases/fir/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=fir FILE=fir_main >& fir_build.case.log 

insertsort_build:
	@cp ./tests/cases/insertsort/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=insertsort FILE=insertsort_main >& insertsort_build.case.log 

nettle_des_build:
	@cp ./tests/cases/nettle_des/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=nettle_des FILE=nettle_des_main >& nettle_des_build.case.log 


nettle_md5_build:
	@cp ./tests/cases/nettle_md5/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=nettle_md5 FILE=nettle_md5_main >& nettle_md5_build.case.log 



cover_build:
	@cp ./tests/cases/cover/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=cover FILE=cover_main >& cover_build.case.log 


ctl_stack_build:
	@cp ./tests/cases/ctl_stack/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=ctl_stack FILE=ctl_stack_main >& ctl_stack_build.case.log 


ctl_vector_build:
	@cp ./tests/cases/ctl_vector/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=ctl_vector FILE=ctl_vector_main >& ctl_vector_build.case.log 

duff_build:
	@cp ./tests/cases/duff/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=duff FILE=duff_main >& duff_build.case.log 

jfdctint_build:
	@cp ./tests/cases/jfdctint/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=jfdctint FILE=jfdctint_main >& jfdctint_build.case.log 


lcdnum_build:
	@cp ./tests/cases/lcdnum/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=lcdnum FILE=lcdnum_main >& lcdnum_build.case.log 

qurt_build:
	@cp ./tests/cases/qurt/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=qurt FILE=qurt_main >& qurt_build.case.log 


sglib_dllist_build:
	@cp ./tests/cases/sglib_dllist/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=sglib_dllist FILE=sglib_dllist_main >& sglib_dllist_build.case.log 

sglib_hashtable_build:
	@cp ./tests/cases/sglib_hashtable/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=sglib_hashtable FILE=sglib_hashtable_main >& sglib_hashtable_build.case.log 

sglib_listinsertsort_build:
	@cp ./tests/cases/sglib_listinsertsort/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=sglib_listinsertsort FILE=sglib_listinsertsort_main >& sglib_listinsertsort_build.case.log 


sglib_rbtree_build:
	@cp ./tests/cases/sglib_rbtree/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=sglib_rbtree FILE=sglib_rbtree_main >& sglib_rbtree_build.case.log 


sha_build:
	@cp ./tests/cases/sha/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=sha FILE=sha_main >& sha_build.case.log 


trio_sscanf_build:
	@cp ./tests/cases/trio_sscanf/* ./work
	@find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; 
	@cp ./tests/lib/clib/* ./work
	@cp ./tests/lib/newlib_wrap/* ./work
	@cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=e906f CPU_ARCH_FLAG_1=nodsp  ENDIAN_MODE=little-endian CASENAME=trio_sscanf FILE=trio_sscanf_main >& trio_sscanf_build.case.log 














# Adjust verilog filelist for *.v case...
ifeq ($(CASE), debug_2wire_jtag)
SIM_FILELIST := ../tests/cases/debug_2wire_jtag/_TEST_MACRO_2_WIRE_JTAG.vh ../tests/cases/debug_2wire_jtag/JTAG_DRV.vh ../tests/cases/debug_2wire_jtag/E906_DEBUG_PATTERN.v
endif
ifeq ($(CASE), debug)
SIM_FILELIST := ../tests/cases/debug/JTAG_DRV.vh ../tests/cases/debug/E906_DEBUG_PATTERN.v
endif


define newline


endef


